package org.example.controller;

import org.example.domain.User;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * (User)表控制层
 *
 * @author hsx
 * @since 2023-10-10 15:15:17
 */
@RestController
@RequestMapping("user")
public class UserController{

    @Autowired
    private UserService userService;

    @GetMapping("{id}")
    public User selectById(@PathVariable Long id) {
        return userService.selectUserById(id);
    }

    @GetMapping("username/{username}")
    public User selectByUsername(@PathVariable String username){
        return userService.selectUserByUsername(username);
    }

}

